using System;
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using LiveHub.AvaloniaApp.ViewModels.Pages;

namespace LiveHub.AvaloniaApp.Models;

public class NavigationFactory : INavigationPageFactory
{
    public Control GetPage(Type srcType)
    {
        throw new Exception();
    }

    public Control GetPageFromObject(object target)
    {
        return target switch
        {
            PageModelBase pageModelBase => pageModelBase.GetPage(),
            Control control => control,
            _ => throw new Exception()
        };
    }
}